home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: diamond@tko.dec.com (Norman Diamond)
- Newsgroups: comp.std.c,comp.lang.c.moderated
- Subject: Re: Integral promotion.
- Date: 21 Feb 1996 08:42:05 -0600
- Organization: Digital Equipment Corporation Japan , Tokyo
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4gfavt$21b@solutions.solon.com>
- References: <4fstj7$2l6@solutions.solon.com> <4fu835$9de@solutions.solon.com> <4fvgrm$dv9@solutions.solon.com> <4g28hr$qko@solutions.solon.com> <4g54pv$ajt@solutions.solon.com>
- Reply-To: diamond@jrdv04.enet.dec-j.co.jp (Norman Diamond)
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4g54pv$ajt@solutions.solon.com>, msb@sq.com writes:
- >I wrote:
- >>> Thus even in ANSI C, if this function is called this way:
- >>>extern short p, q, r, test(short,short);
- >>>r = test(p,q);
- >>> the values from p and q are still converted from short to int and back
- >>> to short.
-
- >Thad Smith (ThadSmith@acm.org) responded:
- >>I find nothing in the Standard that states that the arguments undergo
- >>integral promotions before being assigned to the function parameters.
-
- >This is in 6.2.1.1/3.2.1.1, the passage which defines the integral
- >promotions. It states that the promotions apply
- ># in an expression wherever an int or unsigned int may be used.
-
- It does not. 6.2/3.2 begins with the sentence: "Several operators
- convert values from one type to another automatically." The entire
- section proceeds to describe what kinds of conversions occur in which
- kinds of contexts, all within the context of which operators convert
- values automatically. The entire section is irrelevant to other
- contexts, such as those in which operators do not convert values
- automatically (e.g. postfix ++, e.g. function call, e.g. sizeof,
- even e.g. assignment when the left and right sides have the same type).
-
- Part of the definition of the binary + operator is to perform the
- integral promotions on its operands. There is stuff like this all
- over the chapter on expressions. If all this stuff were unnecessary,
- they might not have repeated it 20 times, or it might have been caught
- and submitted as a defect report many years ago.
-
- You miscorrected Chris Torek and you made him believe you. You
- miscorrected Thad Smith and me, but we aren't falling for it.
- --
- << If this were the company's opinion, I would not be allowed to post it. >>
- "I paid money for this car, I pay taxes for vehicle registration and a driver's
- license, so I can drive in any lane I want, and no innocent victim gets to call
- the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
-